package org.firebug.spring.boot.redisson.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Aspect
@Component
public class DistributedLockAspect {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

//    @Autowired
//    private RedissonClient redissonClient;

//    @Around(value = "execution(public boolean com.xforceplus.athena..*.*(String,..)) && @annotation(com.xforceplus.athena.aspect.SingleDistributedLock)")
    public Object singleDistributedLock(ProceedingJoinPoint point){
        Object result = null;
        Object[] args = point.getArgs();
        try {
            result = point.proceed(args);
        } catch (Throwable t) {
            logger.error("{}", t);
        } finally {
        }
        return result;
    }
}